package com.nali.dal.expression;

import java.io.Serializable;

public class ExpressionValue<T extends Expression> implements Serializable {
	private static final long serialVersionUID = -3558915275858895771L;
	private PropertyExpression<T> propertyExpression;
	private Serializable value;
	@SuppressWarnings("unused")
	private ExpressionValue() {
	}
	public ExpressionValue(PropertyExpression<T> propertyExpression, Serializable value) {
		super();
		this.propertyExpression = propertyExpression;
		this.value = value;
	}
	public ExpressionValue(PropertyExpression<T> propertyExpression, Serializable... value) {
		this(propertyExpression, (Serializable)value);
	}
	public ExpressionValue(String propertyName, T expression, Serializable value) {
		this(new PropertyExpression<T>(propertyName, expression), value);
	}
	public ExpressionValue(String propertyName, T expression, Serializable... value) {
		this(new PropertyExpression<T>(propertyName, expression), (Serializable)value);
	}
	public Serializable getValue() {
		return value;
	}
	public PropertyExpression<T> getPropertyExpression() {
		return propertyExpression;
	}
	@Override
	public String toString() {
		return propertyExpression.getPropertyName() + "." + propertyExpression.getExpression()
				+ "(" + value + ")";
	}
}
